package org.jflame.auth.authc;

/**
 * 通用的用户身份信息类
 * 
 * @author charles.zhang
 */
public class SimpleAuthcInfo {

    protected Object principal;
    protected Object credentials;
    protected String credentialsSalt;
    private String id;
    private boolean locked;
    private boolean disabled;
    private boolean credentialExpired;

    public SimpleAuthcInfo() {
    }

    public SimpleAuthcInfo(Object principal, Object credentials, String credentialsSalt) {
        this(null, principal, credentials, credentialsSalt, false, false, false);
    }

    public SimpleAuthcInfo(String id, Object principal, Object credentials, String credentialsSalt) {
        this(id, principal, credentials, credentialsSalt, false, false, false);
    }

    public SimpleAuthcInfo(String id, Object principal, Object credentials, String credentialsSalt, boolean locked,
            boolean disabled, boolean credentialExpired) {
        this.id = id;
        this.locked = locked;
        this.disabled = disabled;
        this.principal = principal;
        this.credentials = credentials;
        this.credentialsSalt = credentialsSalt;
    }

    public Object getPrincipal() {
        return principal;
    }

    public String stringPrincipal() {
        return principal != null ? principal.toString() : null;
    }

    public void setPrincipal(Object principal) {
        this.principal = principal;
    }

    public void setCredential(Object credentials) {
        this.credentials = credentials;
    }

    public Object getCredential() {
        return credentials;
    }

    public String getCredentialsSalt() {
        return credentialsSalt;
    }

    public void setCredentialsSalt(String credentialsSalt) {
        this.credentialsSalt = credentialsSalt;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public boolean isLocked() {
        return locked;
    }

    public void setLocked(boolean locked) {
        this.locked = locked;
    }

    public boolean isDisabled() {
        return disabled;
    }

    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

    public boolean isCredentialExpired() {
        return credentialExpired;
    }

    public void setCredentialExpired(boolean credentialExpired) {
        this.credentialExpired = credentialExpired;
    }

}
